# Maintainer: Jonathan Steel <jsteel@aur.archlinux.org>
# Contributor: Justin Davis <jrcd83@gmail.com>

pkgname=perl-data-optlist
pkgver=0.114
pkgrel=2
pkgdesc="Parse and validate simple name/value option pairs"
arch=('any')
license=('PerlArtistic' 'GPL')
options=('!emptydirs')
depends=('perl-params-util' 'perl-scalar-list-utils' 'perl-sub-install')
makedepends=('perl-extutils-makemaker')
url="https://metacpan.org/release/Data-OptList"
source=(https://search.cpan.org/CPAN/authors/id/R/RJ/RJBS/Data-OptList-$pkgver.tar.gz)
sha512sums=('72f60ad7d9a6d87ffecfbc0f6f6d48dad2816dd4431d7e82e8ab834e0852da27420fd52fb2a1138254d80bf8b98b94b9fa25b878e1bb155221543a78219ee16a')

build() {
  ( export PERL_MM_USE_DEFAULT=1 PERL5LIB=""  \
      PERL_AUTOINSTALL=--skipdeps             \
      PERL_MM_OPT="INSTALLDIRS=vendor"        \
      PERL_MB_OPT="--installdirs vendor"      \
      MODULEBUILDRC=/dev/null
    cd "$srcdir"/Data-OptList-$pkgver

    /usr/bin/perl Makefile.PL
    make
  )
}

check() {
  ( export PERL_MM_USE_DEFAULT=1 PERL5LIB=""
    cd "$srcdir"/Data-OptList-$pkgver

    make test
  )
}

package() {
  cd "$srcdir"/Data-OptList-$pkgver

  make DESTDIR="$pkgdir"/ install
}
